home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / misc / RenderLib.lha / RenderLib / doc / debug < prev    next >
Encoding:
Text File  |  1997-06-22  |  1.5 KB  |  45 lines

  1.  
  2. debugging
  3. -----------------------------
  4.  
  5.   render.library provides a rather strict debugging strategy.
  6.   the internal error manager looks like this:
  7.  
  8.     if (parameter_in_valid_range)
  9.     {
  10.         ...
  11.     }
  12.     else
  13.     {
  14.         Exception_ILLEGAL();
  15.         
  16.         /* causing a $80000004 software failure */
  17.     }
  18.  
  19.   it might appear strange at first sight, but this technique has
  20.   enormous advantages for you and me. invalid parameters have got
  21.   few chance to infiltrate the code and play havoc where it becomes
  22.   really dangerous and hard to understand.
  23.  
  24.   the illegal exception (caused by an ILLEGAL opcode) is a 'clean'
  25.   crash without further damage, and it can easily be catched with
  26.   debuggers.
  27.  
  28.   so this exception might become your worst enemy when programming
  29.   render.library. if you encounter dozens of $80000004 requesters
  30.   and can't get rid of them, it is very likely that the problem sits
  31.   in front of your computer.
  32.  
  33.   this can easily drive you berzerk especially with DeleteRMHandler().
  34.   that's another reason why it's highly recommended to use a
  35.   memhandler whenever possible: you get a built-in memory-deallocation
  36.   reminder for free. if DeleteRMHandler() crashes with an ILLEGAL
  37.   exception, you know exactly that you forgot to free memory, or to
  38.   delete a render.library instance such as palettes, histograms, or
  39.   engines.
  40.  
  41.   this debugging concept is not provided with every function, though,
  42.   but maybe i will apply it to more or even all functions in the future.
  43.   it proved to be a very reliable error treatment, since it just cannot
  44.   be ignored.
  45.